import request from './request'

const useHttp = (config) => {
  return new Promise((resolve, reject) => {
    request({
      url: config.url,
      method: config.method,
      params: config.params,
      data: config.data,
    }).then(res => {
      resolve(res.data)
    }).catch(err => {
      reject(err)
    })
  })
}

export default useHttp
